package com.ls.socketio.repository.dao;

import com.ls.socketio.bean.RoomBoxInfo;
import com.ls.socketio.bean.RoomInfo;
import com.ls.socketio.repository.RoomRepository;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;
import java.util.List;

/**
 * @author liShan
 * @date 2019/9/3 17:42
 */
@Component
public class RoomRepositoryImpl {

    @Resource
    private RoomRepository roomRepository;

    /**
     * 添加酒店栋数楼层房间
     * @param roomInfo 酒店栋数楼层房间
     */
    public void addRoom(RoomInfo roomInfo){
        roomRepository.save(roomInfo);
    }

    /**
     * 查询房间的id，根据房间的位置
     * @param boxInfo  房间的位置
     * @return 房间的id
     */
    public Long findRoomId(RoomBoxInfo boxInfo){
        return roomRepository.findRoomId(boxInfo);
    }

    /**
     * 根据楼层id房间
     * @param layerId 楼层id
     * @return 房间的集合
     */
    public List<RoomInfo> findRoomByLayerId(Long layerId){
        return roomRepository.findRoomByLayerId(layerId);
    }

}
